<?php
namespace Home\Controller;
use Think\Controller;
class PeopleController extends BaseController {
    public function index(){
        $arr = array(
            array('name'=>'zhangsan','age'=>18,'sex'=>'男','time'=>1535944882),
            array('name'=>'小明','age'=>23,'sex'=>'女','time'=>1535144882),
        );

        foreach($arr as $k=>$v){
            $arr[$k]['time'] = date("Y-m-d H:i:s",$v['time']);
            $arr[$k]['age'] = $v['age']+1;
        }
        $data['name'] = 'ThinkPHP';
        $data['email'] = 'thinkphp@qq.com';
        $this->assign('data',$data);
//        echo json_encode($arr);

        $this->assign('arr',$arr);
//        $this->assign('name','张三');

        $this->display();
    }
    public function searchResult(){
        $res = D('People')->search();
        echo json_encode($res);
    }
}